package com.tbit.main.service.impl;

import com.tbit.main.constant.DaoParamConstant;
import com.tbit.main.dao.stat.RideCardOrderDayStaDao;
import com.tbit.main.pojo.RideCardOrderDaySta;
import com.tbit.main.service.RideCardOrderDayStaService;
import com.tbit.main.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author LMY
 * @create 2021-01-11 20:26
 * 骑行会员订单日统计
 */
@Service("rideCardOrderDayStaService")
public class RideCardOrderDayStaServiceImpl implements RideCardOrderDayStaService {

    @Autowired
    private RideCardOrderDayStaDao rideCardOrderDayStaDao;

    @Override
    public List<RideCardOrderDaySta> getByAccountIdDateDay(List<Integer> accountIds, String startDate, String endDate) {
        Map<String, Object> map = new HashMap<>();
        map.put(DaoParamConstant.accountId, StringUtil.getListString(accountIds));
        map.put("startDate", startDate);
        map.put("endDate", endDate);
        return rideCardOrderDayStaDao.getByAccountIdDateDay(map);
    }

    @Override
    public List<RideCardOrderDaySta> getByAccountIdDateWeek(List<Integer> accountIds, String startDate, String endDate) {
        Map<String, Object> map = new HashMap<>();
        map.put(DaoParamConstant.accountId, StringUtil.getListString(accountIds));
        map.put("startDate", startDate);
        map.put("endDate", endDate);
        return rideCardOrderDayStaDao.getByAccountIdDateWeek(map);
    }

    @Override
    public List<RideCardOrderDaySta> getByAccountIdDateMonth(List<Integer> accountIds, String startDate, String endDate) {
        Map<String, Object> map = new HashMap<>();
        map.put(DaoParamConstant.accountId, StringUtil.getListString(accountIds));
        map.put("startDate", startDate);
        map.put("endDate", endDate);
        return rideCardOrderDayStaDao.getByAccountIdDateMonth(map);
    }

    @Override
    public Map<String, Object> getByAccountId(Integer accountId, String startDate, String endDate) {
        Map<String, Object> map = new HashMap<>();
        map.put("accountId", accountId);
        map.put("startDate", startDate);
        map.put("endDate", endDate);
        return rideCardOrderDayStaDao.getByAccountId(map);
    }
}
